//
//  PartnerDetailViewController.m
//  beautyLamp
//
//  Created by Tam Kwok To Michael on 2017/8/21.
//  Copyright © 2017年 Tam Kwok To Michael. All rights reserved.
//

#import "PartnerDetailViewController.h"
#import "PartnerDetailHeadView.h"
#import "PlaceOrderViewController.h"
#import <MBProgressHUD.h>
#import "BLHeader.h"
#import "Partner.h"

@interface PartnerDetailViewController () <UITableViewDelegate, UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIButton *orderBtn;
@end

@implementation PartnerDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
}


- (void)setupUI {
    self.title = self.partner.name;
    PartnerDetailHeadView *head = [PartnerDetailHeadView partnerDetailHeadView];
    head.frame = CGRectMake(0, 0, KScreenWidth, 300);
    head.partner = self.partner;
    //NSLog(@"---》 %@", self.partner.ratio);
    self.tableView.tableHeaderView = head;
    self.tableView.tableFooterView = [UIView new];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    return nil;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

#pragma mark 跳转到创建订单界面
- (IBAction)toOrderController:(id)sender {
    NSString *userClass = [[NSUserDefaults standardUserDefaults] objectForKey:USERCLASS];
    if ([userClass integerValue] == 1) {
        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        hud.mode = MBProgressHUDModeText;
        hud.label.text = @"店主不能下单的哦！";
        [hud hideAnimated:YES afterDelay:3];
        return;
    }
    PlaceOrderViewController *controller = [[PlaceOrderViewController alloc] init];
    [self.navigationController pushViewController:controller animated:YES];
}

@end
